import processing.opengl.*;

/**
 * Color Space Manager
 * by Xavier Gouchet (2008)
 */
 
boolean gl = false;
int value = 128;
float radius = 100;
float depth = 300;
int steps = 0;
int maxsteps = 4;
int[] colors;
float[][] positions;
void setup(){
  if (gl){
    size(400, 400, OPENGL); 
    hint(ENABLE_OPENGL_2X_SMOOTH);
  }
  else{
    size(400, 400, P3D);
  }

  // Enable mouse wheel settings
  addMouseWheelListener(new java.awt.event.MouseWheelListener() {
    public void mouseWheelMoved(java.awt.event.MouseWheelEvent evt) {
      int rotation = evt.getWheelRotation();
      value += rotation*5;
      if (value < 0) value = 0;
      if (value > 255) value = 255;
    }
  }
  ); 
  
  colors = new int[maxsteps];
  positions = new float[maxsteps][3];
}

void draw(){
  // basic settings
  //ortho(0, width, 0, height, -10, 10);
  background(128);


  // set lights
  pushMatrix();
  rotateY(PI/3);
  //lights();
  popMatrix();

  // Color settings
  noStroke();
  colorMode(HSB,255);

  // Draw Munsell Space
  pushMatrix();
  translate(200, 100,-75);
  rotateY(PI/2);
  rotateZ(-PI/6);
  //munsellCylinder(25); 
  munsellDisc(25);
  munsellSphere();
  munsellBezier();
  popMatrix();
  
  // Draw Sample Color
  pushMatrix();
  translate(10,10,-25);
  munsellPalette();
  popMatrix();
}

void mousePressed() {  
  if ( (mouseEvent.getModifiers() & InputEvent.BUTTON1_MASK ) !=0) {  
    munsellClick();
  }  
  else if ( (mouseEvent.getModifiers() & InputEvent.BUTTON2_MASK) != 0) {  

  }  
  else if ( (mouseEvent.getModifiers() & InputEvent.BUTTON3_MASK) != 0) {  
    println('3');
  }  
}


